/** 
 * YAxisPolicy.java
 * @author Lex
 * 2007-8-27 ����10:34:27
 */
package fun.ui.canvas;

public enum YAxisPolicy {
    /** �����ֵ/��Сֵ��Χ���Զ����� */
    AUTO_SCALE("Auto Scale"),
    /** ������X����ͬ�����ű���������������"��ʵ"��ͼ */
    BIND_TO_X("Bind to X Axis"),
    /** �ֶ�ָ�� */
    CUSTOM("Custom");

    private static YAxisPolicy[] all = null;
    private static String[] displayNames = null;

    public static YAxisPolicy parse(String displayName) {
	if (null == all)
	    all = YAxisPolicy.values();
	for (YAxisPolicy p : all)
	    if (p.getDiaplayName().equals(displayName))
		return p;
	return null;
    }

    public static String[] displayNames() {
	if (null == displayNames) {
	    if (null == all)
		all = YAxisPolicy.values();
	    displayNames = new String[all.length];
	    for (int i = 0; i < all.length; i++)
		displayNames[i] = all[i].getDiaplayName();
	}
	return displayNames;
    }

    private String displayName = null;

    private YAxisPolicy(String displayName) {
	this.displayName = displayName;
    }

    public String getDiaplayName() {
	return this.displayName;
    }
}